package com.paas.form.controller;


import com.alibaba.fastjson2.JSONObject;
import com.paas.common.util.BeanUtil;
import com.paas.form.vo.personbaseinfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping(value = "/apis/fenfareceive")
@Api(description = "分发接收", tags = "")
public class FenfaReceive {



    @RequestMapping(value = "/fenfaOne", method = RequestMethod.POST)
    @ApiOperation(value = "分发接收接口one", notes = "分发接收接口one")
    public void fenfaOne(@RequestBody personbaseinfo data, HttpServletRequest request) throws IOException {
        log.info("分发接收接口one被访问");
        Map parameterMap=request.getParameterMap();
        if(BeanUtil.isNotEmpty(data)){
            String dataStr=data.toString();
            log.info("One分发接收的数据："+dataStr);
        }



    }


    @RequestMapping(value = "/fenfaTwo", method = RequestMethod.POST)
    @ApiOperation(value = "分发接收接口one", notes = "分发接收接口one")
    public void fenfaTwo(HttpServletRequest request,String twoparam) throws IOException {
        log.info("分发接收接口two被访问");
        BufferedReader br = request.getReader();
        String str, wholeStr = "";
        while((str = br.readLine()) != null){
            wholeStr += str;
        }
        log.info("Two分发接收的body："+wholeStr);

        Map parameterMap=request.getParameterMap();



    }


    @RequestMapping(value = "/fenfaThree", method = RequestMethod.POST)
    @ApiOperation(value = "分发接收接口Three", notes = "分发接收接口Three")
    public void fenfaThree(@RequestBody JSONObject jsonObject, HttpServletRequest request) throws IOException {
        log.info("分发接收接口Three被访问");
        Map parameterMap=request.getParameterMap();
        if(BeanUtil.isNotEmpty(jsonObject)){
            String dataStr=jsonObject.toString();
            log.info("Three分发接收的数据："+dataStr);
        }


    }
    @RequestMapping(value = "/fenfaFour", method = RequestMethod.POST)
    @ApiOperation(value = "分发接收接口Four", notes = "分发接收接口Four")
    public void fenfaFour(@RequestBody personbaseinfo data, HttpServletRequest request) throws IOException {
        log.info("分发接收接口Four被访问");
        Map parameterMap=request.getParameterMap();
        if(BeanUtil.isNotEmpty(data)){
            String dataStr=data.toString();
            log.info("Four分发接收的数据："+dataStr);
        }


    }






}
